PSA Object Model Diagrams

APIBillingService

global with sharing class APIBillingService

Enums

ObjectTypesRelease

Value Description
batch Group of one or more billing events.
event Group of one or more billing event items.

ObjectTypesRemove

Value Description
batch Group of one or more billing events.
event Group of one or more billing event items.
item Billing event item.

ObjectTypesClear

Value Description
budget business objects that you can clear the billing data for.
event business objects that you can clear the billing data for.
expense business objects that you can clear the billing data for.
expense_report business objects that you can clear the billing data for.
item business objects that you can clear the billing data for.
milestone business objects that you can clear the billing data for.
misc_adj business objects that you can clear the billing data for.
timecard business objects that you can clear the billing data for.
timecard_split business objects that you can clear the billing data for.
billing_event_batch business objects that you can clear the billing data for.

Methods

generate

global static APICommonsService.BatchStatus generate(APIBillingService.BillingContextGenerate bc)

Generates billing events using the values in the input parameters

Input Parameters

Name Type Description
bc APIBillingService.BillingContextGenerate Structure containing the criteria on which to generate billing events.

Return Value

This method returns an APICommonsService.BatchStatus object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

release

global static APICommonsService.BatchStatus release(APIBillingService.BillingContextRelease bc)

Validates that all billing events are in an unreleased state and executes the FinancialForce PSA release process for the billing events specified in the input parameters.

Input Parameters

Name Type Description
bc APIBillingService.BillingContextRelease Structure containing a list of IDs of billing event belonging to unreleased billing events to be released.

Return Value

This method returns a APICommonsService.BatchStatus object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

invoice

global static APICommonsService.BatchStatus invoice(APIBillingService.BillingContextInvoice bc)

Validates that all billing events specified in the input parameters are unreleased and are not invoiced and then executes the FinancialForce PSA invoice process for the billing events specified in the input parameters.

Input Parameters

Name Type Description
bc APIBillingService.BillingContextInvoice Structure containing a list of invoice information for billing events that are to be invoiced.

Return Value

This method returns an APICommonsService.BatchStatus object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

recalc

global static APICommonsService.BatchStatus recalc(APIBillingService.BillingContextRecalc bc)

Validates whether all billing events are in an unreleased state and executes the FinancialForce PSA recalc process for the billing events specified in the input parameters.

Input Parameters

Name Type Description
bc APIBillingService.BillingContextRecalc Structure containing a list of IDs of billing events belonging to unreleased billing events to recalculate billing data for.

Return Value

This method returns a APICommonsService.BatchStatus object.

remove

global static APICommonsService.BatchStatus remove(APIBillingService.BillingContextRemove bc)

Removes billing events using the parameters specified. This deletes unreleased billing events or billing event items belonging to unreleased billing event items depending on the input provided.

Input Parameters

Name Type Description
bc APIBillingService.BillingContextRemove Structure containing a list of IDs of billing events or billing event items belonging to unreleased billing events.

Return Value

This method returns an APICommonsService.BatchStatus object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

clear

global static APICommonsService.BatchStatus clear(APIBillingService.BillingContextClear bc)

Clears the billing data for the objects specified in the input parameters.

Input Parameters

Name Type Description
bc APIBillingService.BillingContextClear Structure containing an ID of a business record to clear billing data for and the type of object to which it belongs.

Return Value

This method returns a APICommonsService.BatchStatus object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

schedule

global static APICommonsService.BatchStatus schedule(APIBillingService.BillingContextSchedule bc)

Schedules billing event generation using the input parameters specified.

Input Parameters

Name Type Description
bc APIBillingService.BillingContextSchedule Structure containing the criteria on which to schedule billing event generation.

Return Value

This method returns an APICommonsService.BatchStatus object with a status of either Error or Scheduled.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

status

global static APICommonsService.BatchStatus status(ID jobID)

Returns the status of the job from the job's object status field.

Input Parameters

Name Type Description
jobID ID ID of the job to provide the status for.

Return Value

This method returns an APICommonsService.BatchStatus object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

fetch

global static APIBillingService.BillingResults fetch(APIBillingService.BillingContextFetch bc)

Returns a list of billing event batches. The billing event batches returned are filtered depending on the values specified in the input parameters.

Input Parameters

Name Type Description
bc APIBillingService.BillingContextFetch Structure containing the criteria on which to filter billing data.

Return Value

This method returns a APIBillingService.BillingResults object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

APIBillingService.BillingContextGenerate

global class BillingContextGenerate extends APICommonsService.BatchContext

a structure containing the criteria on which to generate billing events. this class/type extends apicommonsservice.batchcontext

This class extends APICommonsService.BatchContext

Properties

Name Type Description
regionID ID id of the region, practice or group to filter billing event generation on. you can specify any combination of one regionid, one practiceid and one groupid, but at least one regionid, practiceid or groupid must be specified. child regions, practices and groups are included automatically.
practiceID ID id of the region, practice or group to filter billing event generation on. you can specify any combination of one regionid, one practiceid and one groupid, but at least one regionid, practiceid or groupid must be specified. child regions, practices and groups are included automatically.
groupID ID id of the region, practice or group to filter billing event generation on. you can specify any combination of one regionid, one practiceid and one groupid, but at least one regionid, practiceid or groupid must be specified. child regions, practices and groups are included automatically.
timePeriodID ID id of the time period to generate billing events for. if useflexibleperiods is true, this parameter is ignored.
accountID ID id of the account to generate billing events for.
projectID ID id of the project to generate billing events for.
billingCalculationID ID id of the billing calculation record created by the generation process.
includePriorPeriods Boolean determines whether billing events are to be generated for all time periods prior to and including the one in timeperiodid. when false, billing events are only generated for the time period specified in timeperiodid. if useflexibleperiods is true, this parameter is ignored.
useFlexiblePeriods Boolean indicates whether billing events are to be generated in flexible time period mode. when in this mode, billing events are based on the cutoff date instead of a time period. billing events are generated for time periods that end on or before the date you specify according to the time period type for which the account or project is to be billed. all business object records are grouped into billing events based on the time period types for which the account or project is to be billed.
cutoff Date the cut-off date on which to base project and account billing events. this parameter is ignored when useflexibleperiods is false. this is the latest inclusive date for which billing events are to be generated. the cut-off date is compared to the effective date on each region, practice, group, project and account and billing events are generated based on this comparison.

APIBillingService.BillingContextRelease

global class BillingContextRelease extends APICommonsService.BatchContext

a structure containing a list of ids of billing events belonging to unreleased billing events to be released. this class/type extends apicommonsservice.batchcontext.

This class extends APICommonsService.BatchContext

Properties

Name Type Description
ids Set<ID> set of billing event ids belonging to unreleased billing events.
objectType APIBillingService.ObjectTypesRelease type of billing record being released.

APIBillingService.BillingContextInvoice

global class BillingContextInvoice extends APICommonsService.BatchContext

a structure containing a list of invoice information for billing events that are to be invoiced.

This class extends APICommonsService.BatchContext

Properties

Name Type Description
invoiceInfo List<BillingEventsManager.InvoiceInfo> list of invoice information for billing events that are to be invoiced

APIBillingService.BillingContextRecalc

global class BillingContextRecalc extends APICommonsService.BatchContext

a structure containing a list of ids of unreleased billing events on which to recalculate billing data for. this class/type extends apicommonsservice.batchcontext.

This class extends APICommonsService.BatchContext

Properties

Name Type Description
billingEventIds Set<ID> set of billing event ids belonging to unreleased billing events.

APIBillingService.BillingContextRemove

global class BillingContextRemove extends APICommonsService.BatchContext

a structure containing a list of ids of billing records belonging to unreleased billing events to be removed.

This class extends APICommonsService.BatchContext

Properties

Name Type Description
ids Set<ID> set of billing record ids of unreleased billing events to be removed. this must contain ids of objects that belong to the same type. for instance, either billing event items or billing events.
objectType objectTypesRemove type of billing record being removed.

APIBillingService.BillingContextClear

global class BillingContextClear extends APICommonsService.BatchContext

a structure containing an id of a billing record belonging to unreleased billing events to clear billing data for.

This class extends APICommonsService.BatchContext

Properties

Name Type Description
id ID deprecated: see ids
ids Set<ID> ids of billing events, billing event items, billing event batches, timecards, timecard splits, expense reports, expenses, milestones, budgets, or miscellaneous adjustments.
objectType APIBillingService.ObjectTypesClear type of object to which the id belongs.

APIBillingService.BillingContextSchedule

global class BillingContextSchedule extends APICommonsService.BatchContext

a structure containing the criteria on which to schedule billing event generation.

This class extends APICommonsService.BatchContext

Properties

Name Type Description
regionID ID id of the region, practice or group to schedule billing event generation for. at least one regionid, practiceid or groupid must be specified. if any one of these contains a null value, this means that billing events will be generated for any child regions, practices or groups.
practiceID ID id of the region, practice or group to schedule billing event generation for. at least one regionid, practiceid or groupid must be specified. if any one of these contains a null value, this means that billing events will be generated for any child regions, practices or groups.
groupID ID id of the region, practice or group to schedule billing event generation for. at least one regionid, practiceid or groupid must be specified. if any one of these contains a null value, this means that billing events will be generated for any child regions, practices or groups.
timePeriodID ID id of the time period to generate billing events for. if useflexibleperiods is true, this parameter is ignored.
accountID ID id of the account to generate billing events for.
projectID ID id of the project to generate billing events for.
includePriorPeriods Boolean determines whether billing events are to be generated for all time periods prior to the one in timeperiodid. if useflexibleperiods is true, this parameter is ignored.
useFlexiblePeriods Boolean indicates whether billing events are to be generated in flexible time period mode. when true, billing events are based on the periodoffset date instead of a time period. the periodoffset determines the cut-off date relative to today's date. when false, the periodoffset indicates which time period to generate billing events for.
periodOffset Integer the offset to use to calculate the cut-off date relative to today's date when useflexibleperiods is true. when useflexibleperiods is false, this determines which time period to generate billing events for. for instance, a value of 0 generates billing events for the current time period and -1 generates billing events for the previous time period.
scheduledJobName String name to be applied to the scheduled job
cronSchedule String string defined by salesforce that represents the schedule used to run the job. for more information, see the apex scheduler topic in the salesforce apex code developer's guide.
cronDaysParm String

APIBillingService.BillingContextFetch

global class BillingContextFetch extends APICommonsService.BatchContext

a structure containing the criteria on which to filter billing data when retrieving billing event batches.

This class extends APICommonsService.BatchContext

Properties

Name Type Description
regionID ID id of the region to filter billing data on.
practiceID ID id of the practice to filter billing data on.
groupID ID id of the group to filter billing data on.
timePeriodID ID id of the time period to filter billing data on.
accountID ID id of the account to filter billing data on.
projectID ID id of the project to filter billing data on.
isReleased Boolean if a value is specified, filters billing data based on whether it is released. when true, only records that are released are returned. when false, only records that are not released are returned. when no value is specified, records are returned regardless of whether they are released.
isInvoiced Boolean if a value is specified, filters billing data based on whether it is invoiced. when true, only records that are invoiced are returned. when false, only records that are not invoiced are returned. when no value is specified, records are returned regardless of whether they are invoiced.
isApproved Boolean if a value is specified, filters billing data based on whether it is approved. when true, only records that are approved are returned. when false, only records that are not approved are returned. when no value is specified, records are returned regardless of whether they are approved.

APIBillingService.BillingResults

global class BillingResults

a structure containing a list of billing event batch containers returned by apibillingservice.fetch.

Properties

Name Type Description
billingEventBatches List<APIBillingService.BEBContainer> a list of billing event batch containers.

APIBillingService.BEBContainer

global class BEBContainer

a structure containing a billing event batch and a billing event container that contains the billing events for that billing event batch.

Properties

Name Type Description
billingEventBatch Billing_Event_Batch__c the billing event batch.
billingEvents List<APIBillingService.BEContainer> a list of billing event containers.

APIBillingService.BEContainer

global class BEContainer

a structure within a bebcontainer that contains a billing event and a list of billing event items which belong to that billing event.

Properties

Name Type Description
billingEvent Billing_Event__c the billing event.
billingEventItems List<Billing_Event_Item__c> a list of billing event items.

APIBillingService.DefaultBillingGenerateHandler

global class DefaultBillingGenerateHandler implements APICommonsService.iBatchCallback

a structure containing the methods in the ibatchcallback interface that hook into the billing generate process. see "interface: ibatchcallback".

This class implements the following interfaces:

Methods

beforeStart

global void beforeStart(APICommonsService.BatchContext bc)

This method is called before the logic of the Start method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

afterStart

global void afterStart(APICommonsService.BatchContext bc)

This method is called after the logic of the Start method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

beforeExecute

global void beforeExecute(APICommonsService.BatchContext bc, Set<ID> scope)

This method is called before the logic of the Execute method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.
scope Set<ID> Contains the IDs of the records being processed in a specific batch.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

afterExecute

global void afterExecute(APICommonsService.BatchContext bc, Set<ID> scope)

This method is called after the logic of the Execute method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.
scope Set<ID> Contains the IDs of the records being processed in a specific batch.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

beforeFinish

global void beforeFinish(APICommonsService.BatchContext bc)

This method is called before the logic of the Finish method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

getJobType

global APICommonsService.BatchJobType getJobType()

This method must be implemented by the creator of any class that implements the iBatchCallback interface. This indicates the FinancialForce PSA billing process that the class is to intends to implement. These FinancialForce PSA billing processes all confirm that the implemented type matches their identity:
• Clear
• Generate
• Invoice
• Recalc
• Release
• Remove

Return Value

This method returns an APICommonsService.BatchJobType object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

afterFinish

global void afterFinish(APICommonsService.BatchContext bc)

This method is called after the logic of the Finish method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

APIBillingService.DefaultBillingReleaseHandler

global inherited sharing class DefaultBillingReleaseHandler implements APICommonsService.iBatchCallback

a structure containing the methods in the ibatchcallback interface that hook into the billing release process. see "interface: ibatchcallback".

This class implements the following interfaces:

Methods

beforeStart

global void beforeStart(APICommonsService.BatchContext bc)

This method is called before the logic of the Start method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

afterStart

global void afterStart(APICommonsService.BatchContext bc)

This method is called after the logic of the Start method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

beforeExecute

global void beforeExecute(APICommonsService.BatchContext bc, Set<ID> scope)

This method is called before the logic of the Execute method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.
scope Set<ID> Contains the IDs of the records being processed in a specific batch.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

afterExecute

global void afterExecute(APICommonsService.BatchContext bc, Set<ID> scope)

This method is called after the logic of the Execute method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.
scope Set<ID> Contains the IDs of the records being processed in a specific batch.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

beforeFinish

global void beforeFinish(APICommonsService.BatchContext bc)

This method is called before the logic of the Finish method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

getJobType

global APICommonsService.BatchJobType getJobType()

This method must be implemented by the creator of any class that implements the iBatchCallback interface. This indicates the FinancialForce PSA billing process that the class is to intends to implement. These FinancialForce PSA billing processes all confirm that the implemented type matches their identity:
• Clear
• Generate
• Invoice
• Recalc
• Release
• Remove

Return Value

This method returns an APICommonsService.BatchJobType object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code

afterFinish

global void afterFinish(APICommonsService.BatchContext bc)

This method is called after the logic of the Finish method of a batch is processed.

Input Parameters

Name Type Description
bc APICommonsService.BatchContext Information about the context of the job.

Return Value

This method does not return a value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code
© Copyright 2009–2021 FinancialForce.com, inc. Confidential – all rights reserved. Various trademarks held by their respective owners.